import scala.math.random

/**
 * 作者: LDL
 * 功能说明:
 * 创建日期: 2015/7/20 18:31
 */
object LocalPi {

    def main(args: Array[String]) {
        var count = 0
        for (i <- 1 to 100000) {
            val x = random * 2 - 1
            val y = random * 2 - 1
            if (x*x + y*y < 1) count += 1
        }
        println("Pi is roughly " + 4 * count / 100000.0)
    }
}
